#include "stdafx.h"
#include "DatabaseConfig.h"


DatabaseConfig::DatabaseConfig()
{
    
}


DatabaseConfig::~DatabaseConfig()
{
}

void DatabaseConfig::load(tinyxml2::XMLElement * element)
{
    if (element == nullptr)
    {
        return;
    }

    if (auto host = element->FirstChildElement("host"))
    {
        host_ = host->GetText();
    }

    if (auto port = element->FirstChildElement("port"))
    {
        port_ = port->IntText();
    }

    if (auto database = element->FirstChildElement("database"))
    {
        database_ = database->GetText();
    }

	if (auto schema = element->FirstChildElement("schema"))
	{
		schema_ = schema->GetText();
	}

    if (auto user = element->FirstChildElement("user"))
    {
        user_ = user->GetText();
    }

    if (auto password = element->FirstChildElement("password"))
    {
        password_ = password->GetText();
    }
}
